using UnityEngine;
using System.Collections;

public class TestBreeding : MonoBehaviour {
	
	public AlienGenome parent1;
	public AlienGenome parent2;
	public AlienGenome child;
	
	public AlienStatsUI parentStat1;
	public AlienStatsUI parentStat2;
	public AlienStatsUI childStat;
	
	public int parent1_Diff= 2;
	public int parent2_Diff= 2;
	
	// Use this for initialization
	void Start ()
	{
		random1();	
		random2();	
		randomChild();
	}
	void random1() 
	{
		if(parent1 != null)
			parent1.lyse();
		
		{
			GameObject alien= AlienMating.spawnAlien(parent1_Diff);
			parent1= alien.GetComponent<AlienGenome>();
			parentStat1.attachAlien( parent1);
			
		}
		
		randomChild();
	}
	
	void random2() 
	{
		if(parent2 != null)
			parent2.lyse();
		
		{
			GameObject alien= AlienMating.spawnAlien(parent2_Diff);
			parent2= alien.GetComponent<AlienGenome>();
			parentStat2.attachAlien( parent2);
		}
		randomChild();
	}
	
	void randomChild() 
	{
		
		if(child != null)
			child.lyse();
		if(parent1 != null && parent2 != null)
		{
			GameObject alien= AlienMating.generateChild(parent1, parent2);
			child= alien.GetComponent<AlienGenome>();
			childStat.attachAlien( child);
		}
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	void OnGUI() {
		if(GUI.Button(new Rect(Screen.width-300, 0, 300, 100), "Randomize 1")) {
			random1();
		}
		if(GUI.Button(new Rect(Screen.width-300, 100, 300, 100), "Randomize 2")) {
			random2();
		}
		if(GUI.Button(new Rect(Screen.width-300, 200, 300, 100), "Breed Child")) {
			randomChild();
		}
	}
}
